CREATE TABLE jms_dm.dm_contract_area_bill_customer_detail_dt (
                                                                 network_code varchar(50) NULL COMMENT "网点code",
                                                                 staff_code varchar(50) NULL COMMENT "业务员code",
                                                                 belong_type int(11) NULL COMMENT "所属类别所属类别1 直营公司2 第三方3 底价业务员",
                                                                 date_time date NULL COMMENT "查询日期",
                                                                 customer_code varchar(50) NULL COMMENT "客户来源",
                                                                 customer_name varchar(120) NULL COMMENT "客户名称",
                                                                 total_bill_count int(11) NULL COMMENT "当日件量",
                                                                 total_weight_count decimal128(22, 2) NULL COMMENT "当日重量",
                                                                 total_bill_mm int(11) NULL COMMENT "当月件量",
                                                                 total_days_mm int(11) NULL COMMENT "当月发货天数",
                                                                 avg_total_bill int(11) NULL COMMENT "日均发货件量",
                                                                 up_bill_cnt int(11) NULL COMMENT "上一日发件量",
                                                                 up_weight_cnt decimal128(22, 2) NULL COMMENT "上一日发件重量",
                                                                 customer_level varchar(50) NULL COMMENT "客户等级 A,B+,B,E,F ",
                                                                 staff_name varchar(50) NULL COMMENT "业务员name",
                                                                 network_name varchar(120) NULL COMMENT "网点name",
                                                                 source_id varchar(50) NULL COMMENT "客户来源id",
                                                                 agent_code varchar(50) NULL COMMENT "网点所属代理区code",
                                                                 agent_name varchar(120) NULL COMMENT "网点所属代理区name",
                                                                 fran_code varchar(50) NULL COMMENT "网点所属加盟商code",
                                                                 fran_name varchar(120) NULL COMMENT "网点所属加盟商name",
                                                                 total_days_mm_bit bigint(20) NULL COMMENT "当月发货天数用二进制表示"
) ENGINE=OLAP 
DUPLICATE KEY(network_code, staff_code, belong_type)
COMMENT "'承包区_客户件量统计表，客户流向数据来源'"
PARTITION BY RANGE(date_time)
(START ("2023-07-01") END ("2023-09-10") EVERY (INTERVAL 1 day))
DISTRIBUTED BY HASH(network_code) BUCKETS 4 
PROPERTIES (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-210",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "4",
"in_memory" = "false",
"storage_format" = "V2"
);

alter table jms_dm.dm_contract_area_bill_customer_detail_dt add column (customer_create_time timestamp comment'客户创建时间',
 total_weight_mm decimal(22,2) comment'当月总重量')
